package com.atcumt.redbook;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main03 {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] nums = new int[n - 1];
        for (int i = 0; i < n - 1; i++) {
            nums[i] = in.nextInt();
        }
        for (int i = 0; i < n + 1; i++) {
            graph.add(new ArrayList<>());
        }
        for (int i = 0; i < n - 1; i++) {
            graph.get(i + 2).add(nums[i]);
            graph.get(nums[i]).add(i + 2);
        }
        int[] res = dfs(1, new boolean[n + 1]);
        System.out.println(res[1]);
        in.close();
    }

    private static List<List<Integer>> graph = new ArrayList<>();

    private static int[] dfs(int node, boolean[] flags) {
        flags[node] = true;
        int maxLen = 0;
        int maxCount = 0;
        boolean c = false;

        for (int next : graph.get(node)) {
            if (!flags[next]) {
                int[] ans = dfs(next, flags);
                maxLen += ans[1];
                if (ans[0] == ans[1]) {
                    c = true;
                }
            }
        }
        maxCount = maxLen;
        if (c) {
            maxCount++;
        }
        return new int[] { maxLen, maxCount };

    }
}
